package com.ww.java17;

public class InstanceOfDemo {
    public static void main(String[] args) {
        Object o = "hello";
        // Old code
        if (o instanceof String) {
            String s = (String) o;
            System.out.println(s);
        }

        // New code
        if (o instanceof String s1) {
            System.out.println(s1);
        }
    }
}
